<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <script src="../../../js/common.js" charset="utf-8"></script>
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">

    <input type="hidden" name="venuesid" autocomplete="off" class="layui-input">
    <div class="layui-form-item">
        <label class="layui-form-label required">场地名称</label>
        <div class="layui-input-block">
            <input type="text" name="venuesname" lay-verify="required" lay-reqtext="场地名称不能为空" placeholder="请输入场地名称" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">场地地址</label>
        <div class="layui-input-block">
            <input type="text" name="changeaddress" lay-verify="required" lay-reqtext="场地地址不能为空" placeholder="请输入场地地址" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">详细地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" lay-verify="required" lay-reqtext="详细地址不能为空" placeholder="请输入详细地址" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">场地负责人</label>
        <div class="layui-input-block">
            <input type="text" name="leadingofficialname" lay-verify="required" lay-reqtext="场地负责人不能为空" placeholder="请输入场地负责人" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">负责人电话</label>
        <div class="layui-input-block">
            <input type="text" name="leadingofficialphone" lay-verify="required" lay-reqtext="负责人电话不能为空" placeholder="请输入负责人电话" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认修改</button>
        </div>
    </div>
</div>
</div>
<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../js/YouJs/config.js"></script>
<script src="../../js/YouJs/reqInterceptor.js"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                url: config.gatewayUri+'/biz/api/venues/admin/UpdateVenues',
                data: {
                    venuesid: $('[name="venuesid"]').val(),
                    venuesname: $('[name="venuesname"]').val(),
                    changeaddress: $('[name="changeaddress"]').val(),
                    address: $('[name="address"]').val(),
                    leadingofficialname: $('[name="leadingofficialname"]').val(),
                    leadingofficialphone: $('[name="leadingofficialphone"]').val(),
                },
                type: 'post',
                dataType: 'json',
                success: function (r) {
                    layer.alert(r.msg);
                    // 获得frame索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                    parent.layer.close(index);
                    //修改成功后刷新父界面
                    window.parent.location.reload();
                },
                error : function (xhr){
                    layer.msg(xhr);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>